#ifndef FILEMANAGER_H
#define FILEMANAGER_H

#include <QWidget>
#include <QIcon>

class QLineEdit;
class QAction;

namespace Jcr
{
class DirTree;
class ImageGallery;
class FileManagerPrivate;
class FileManager : public QWidget
{
    Q_OBJECT
public:
    explicit FileManager(QWidget *parent = 0);
    ~FileManager();

signals:
    void notify(const QString& msg);
    void download(const QUrl& url, const QString& saveName, const QString& saveDir);
    void modelChanged(const QString& model);

protected:
    QSize sizeHint() const;

private:
    void init();

    QAction* createAction(const QString& text, const QIcon& icon = QIcon(), const char* slot = nullptr);
    QAction* createAction(const QString& text, const char* slot = nullptr);

private slots:
    void addDownload();
    void addDownload(const QUrl& url);
    void moveImages();
    void selectAll();
    void editImages();
    void viewImages();
    void deleteImages();
    void setAsDetailedImages();
    void setAsSmallImages();
    void setAsOutdoorImages();
    void onFileDownloaded();
    void onSearchTextChanged(const QString& cond);

private:
    FileManagerPrivate* d_ptr;
    Q_DISABLE_COPY(FileManager)

    QLineEdit* m_searchEdit;
    DirTree* m_dirTree;
    ImageGallery* m_imageGallery;
};

} // namespace
#endif // FILEMANAGER_H
